package org.budo.dubbo.http.client.java;

/**
 * 接口代理基类
 * 
 * @author lmw-2
 */
public class AbstractInterfaceDelegate extends RequestContext {
    public Deferred invokeMethod(String interfaceType, String methodName, Class<?> returnType, Object[] arguments) {
        Deferred deferred = new Deferred();
        deferred.withRequestContext(this);

        deferred.setInterfaceType(interfaceType);
        deferred.setMethodName(methodName);
        deferred.setReturnType(returnType);
        deferred.setArguments(arguments);

        Serialization serialization = this.getSerialization();
        deferred.setRequestBody(serialization.serialize(arguments));

        return deferred;
    }
}